DISK_NAME=`fdisk -l | grep -B 1 'Disk model' | sed -n '1p' | awk -F '[ :]+' '{print $2}'`
fdisk -l ${DISK_NAME} | grep 'Device'
if [ $? -eq 1 ]
then
echo "g
n


+1G
n


+20G
n



t
1
1
t
2
19
p
w
" | fdisk ${DISK_NAME}
mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3
swapon /dev/sda2
fi
echo "#####################################will show swap infos...start#####################################"
swapon -show
echo "#####################################will show swap infos...end#####################################"
mount -l | grep '/dev/sda3' >/dev/null
if [ $? -eq 1 ]
then
mount /dev/sda3 /mnt
fi
if [ ! -d /mnt/boot ]
then
mkdir /mnt/boot
fi
mount -l | grep '/dev/sda1' >/dev/null
if [ $? -eq 1 ]
then
mount /dev/sda1 /mnt/boot
fi
FIRST_LINE_NUMBER=`cat /etc/pacman.d/mirrorlist | grep -n '^[^#]' | sed -n '1p' | awk -F ':' '{print $1}'`	
cat /etc/pacman.d/mirrorlist | grep 'tuna.tsinghua.edu.cn' >/dev/null
if [ $? -eq 1 ]
then
CHINA_URL="http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch"
sed -i ''"${FIRST_LINE_NUMBER}"'i Server = '"${CHINA_URL}"'' /etc/pacman.d/mirrorlist
fi

